package org.example.member.controller;

import org.example.core.utils.PageUtils;
import org.example.core.utils.R;
import org.example.member.bo.MemberBO;
import org.example.member.dto.MemberDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.example.member.service.MemberService;



/**
 * @author xiaojie_cc
 * @version 1.0
 */
@RestController
@RequestMapping("/ums/backend/member")
public class MemberController {

    @Autowired
    private MemberService memberService;

    @GetMapping("/h")
    public R<?> h(){
        return R.ok("w");
    }

    /**
     * 列表
     */
    @GetMapping("/list")
    public R<?> list(MemberDto memberDto){
        PageUtils pageUtils = memberService.list(memberDto);
        return R.ok(pageUtils);
    }

    /**
     * 修改
     */
    @PutMapping("/updateStatus")
    public R<?> updateStatus(@RequestBody MemberBO memberBO){
        memberService.updateStatus(memberBO);
        return R.ok();
    }

    @PostMapping("/{id}/refreshPassword")
    public R<?> refreshPassword(@PathVariable("id") Long id){
        memberService.refreshPassword(id);
        return R.ok();
    }
}